import request, {requestString} from '../../utils/request'

/**
 * 分页查询报价
 *
 */
export async function getQuotationListForPage({ type, loadingPort, destinationPort, declare, trailer, insurance, insuranceAmt,
				province, city, district, street, port, berthingId, lesseeCode, page }) {
	return request(apiPath.mc + "/api/quotation", {
		method: 'get',
		data: {
			type, loadingPort, destinationPort, declare, trailer, insurance, insuranceAmt,
			province, city, district, street, port, berthingId, lesseeCode, page: page.page, size: page.size
		}
	});
}

/**
 * 报价详情
 *
 */
export async function getQuotationDetail(data) {
	return request(apiPath.mc + "/api/quotation/detail", {
		method: 'get',
		data
	});
}

/**
 *保存报价
 *
 * @param quotationForm
 */
export async function addQuotation(quotationForm) {
	return requestString(apiPath.mc + "/api/quotation", {
		method: 'post',
		data: { ...quotationForm }
	});
}

/**
 *计算报价总金额
 *
 * @param data
 */
export async function getTotalAmoumt(data) {
	return requestString(apiPath.mc + "/api/quotation/totalAmoumt", {
		method: 'post',
		data
	});
}

 /**
  * 查询本地费用明细
  *
  * @param quotationConditionForm
  */
export async function getLocalFeeDetail(data){
	return request(apiPath.mc + "/api/feeDetail",{
		method: 'get',
		data
	});
}

/**
 *更新报价
 *
 * @param quotationForm
 */
export async function updateQuotationv(quotationForm) {
	return requestString(apiPath.mc + "/api/quotation", {
		method: 'put',
		data: { ...quotationForm }
	});
}

/**
 * 根据ID获取报价记录详情
 *
 */
export async function getRecordById({id}) {
    return request(apiPath.mc + "/api/quotation/" + id, {
        method: 'get',
    });
}